<%if !@users.blank? %>
<fieldset>
    <legend>
        <% if params[:search].nil? %>
        List of users
        <% else %>
        List of users: Search result
        <% end %>
    </legend>
    
    <p class="p_new">
        <%= link_to [image_tag("user_add.png", :class=>"newitem", :alt=>"New user", :title=>"New user"), 'New user'], {:action => 'new'}, :class=>"newitem" %>
    </p>
    <hr/>       
    <table class="standard">
        <tr>
            <th>Login</th>
            <th>Name</th>
            <th>Role</th>
            <th>Inactive</th>
        </tr>
        
        <% for user in @users %>
        <tr <%if user.is_inactive-%>style="color: gray"<%end-%>>
            <td><%= user.login %></td>
            <td><%= h(truncate(user.name,20)) %></td>
            <td><%= h(truncate(user.role.short_name,20).upcase) %></td>
            <td style="text-align: center"><%if user.is_inactive==true %>X<%end%></td>
            
            <td><%= link_to image_tag("show.png", :alt=>"Show", :title=>"Show"), {:action => 'show', :id => user}, :class=>"nobg" %></td>
            <td><%= link_to image_tag("user_edit.png", :alt=>"Edit", :title=>"Edit"), {:action => 'edit', :id => user}, :class=>"nobg" %></td>
            <td><%= link_to image_tag("user_delete.png", :alt=>"Remove", :title=>"Remove"), { :controller => 'users', :action => 'confirm_destroy', :id => user},
            :confirm => 'Are you sure?', :class=>"nobg" %></td>
        </tr>
        <% end %>
    </table>
    <%= paginate_me @users %>
</fieldset>
<%else%>
<p id="errorNotice">No users found</p>
<%end%>
